package com.hst.capacity.infra.convertor;

import cn.hutool.core.convert.Convert;
import com.hst.capacity.domain.model.entity.setting.fence.FenceInfoEntity;
import com.hst.capacity.domain.model.entity.setting.franchisee.OrderPoolSwicthEntity;
import com.hst.capacity.domain.model.entity.setting.franchisee.VirtualDriverEntity;
import com.hst.capacity.domain.model.entity.setting.price.*;
import com.hst.capacity.domain.model.request.fence.FenceAddParam;
import com.hst.capacity.domain.model.request.setting.franchisee.OrderPoolSwicthParam;
import com.hst.capacity.domain.model.request.setting.franchisee.VirtualDriverParam;
import com.hst.capacity.domain.model.request.setting.price.*;
import com.hst.capacity.domain.model.response.setting.fence.FenceInfoVO;
import com.hst.capacity.domain.model.response.setting.franchisee.OrderPoolSwicthVO;
import com.hst.capacity.domain.model.response.setting.franchisee.VirtualDriverVO;
import com.hst.capacity.domain.model.response.setting.price.*;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.MappingTarget;
import org.mapstruct.ReportingPolicy;
import org.mapstruct.factory.Mappers;

import java.util.List;

/**
 *  定价模块的POJO属性转换器
 *
 * @author jin
 * */
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface SettingPriceConvertor {

    SettingPriceConvertor INSTANCE = Mappers.getMapper(SettingPriceConvertor.class);

    /**
     * 普通定价查询转换
     * @param entityList
     * @return
     */
    @Mapping(target = "idPrice", source = "idServicePriceType")
    List<ExpressSearchVO> convert(List<ExpressCommonPriceEntity> entityList);
    List<ExpressStpSearchVO> convertStp(List<ExpressStpPriceEntity> entityList);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    List<SpecialCarSearchVO> convertSpCar(List<SpecialCarPriceEntity> entityList);


    @Mapping(target = "idServicePriceType", source = "idPrice")
    NewAirportPriceEntity convert2Entity(NewApParam param);
    @Mapping(target = "idServicePriceType", source = "idPrice")
    NewStationPriceEntity convert2Entity(NewStParam entity);
    @Mapping(target = "idServicePriceType", source = "idPrice")
    NewExpressPriceEntity convert2Entity(NewExSaveParam entity);
    @Mapping(target = "idServicePriceType", source = "idPrice")
    @Mapping(target = "priceContent", source = "priceContent2")
    AirportCommonPriceEntity convert2Entity(ApCommonParam param);
    @Mapping(target = "idServicePriceType", source = "idPrice")
    @Mapping(target = "priceContent", source = "priceContent2")
    StationCommonPriceEntity convert2Entity(StCommonParam entity);

    @Mapping(target = "idPrice", source = "idServicePriceType")
    ExpressPriceVO convertExPrice(ExpressCommonPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    ExpressStpPriceVO convertStpPrice(ExpressStpPriceEntity entity);
    @Mapping(target = "idPrice", source = "idIntercityLinePrice")
    IntercityPriceVO convertIcPrice(IntercityPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    SpecialCarPriceVO convertSpCarPrice(SpecialCarPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    AirportPriceVO convertAirportPrice(AirportPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    RailwayStationPriceVO convertRailwayStationPrice(RailwayStationPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    NewAirportPriceVO convertNewAirportPrice(NewAirportPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    NewStationPriceVO convertNewStationPrice(NewStationPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    NewExpressPriceVO convertNewExPrice(NewExpressPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    @Mapping(target = "priceContent2", source = "priceContent")
    NewAirportPriceVO convertNewAirportPrice(AirportCommonPriceEntity entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    @Mapping(target = "priceContent2", source = "priceContent")
    NewStationPriceVO convertNewStationPrice(StationCommonPriceEntity entity);

    @Mapping(target = "idPrice", source = "idServicePriceType")
    List<NewAirportPriceVO> convert2ApLst(List<NewAirportPriceEntity> entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    List<NewStationPriceVO> convert2StLst(List<NewStationPriceEntity> entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    List<NewExpressPriceVO> convert2NewExLst(List<NewExpressPriceEntity> entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    @Mapping(target = "priceContent2", source = "priceContent")
    List<NewAirportPriceVO> convert2ApCommonLst(List<AirportCommonPriceEntity> entity);
    @Mapping(target = "idPrice", source = "idServicePriceType")
    @Mapping(target = "priceContent2", source = "priceContent")
    List<NewStationPriceVO> convert2StCommonLst(List<StationCommonPriceEntity> entity);

    ExSaveParam convertExSelect(ExpressCommonPriceEntity entity);

    StpSaveParam convertStpSelect(ExpressStpPriceEntity entity);
    IcSaveParam convertIcSelect(IntercityPriceEntity entity);
    SpSaveParam convertSpSelect(SpecialCarPriceEntity specialCarPriceEntity);

    OrderPoolSwicthEntity convert2Entity(OrderPoolSwicthParam param);
    OrderPoolSwicthVO convert2VO(OrderPoolSwicthEntity entity);
    List<OrderPoolSwicthVO> convert2Lst(List<OrderPoolSwicthEntity> entity);

    VirtualDriverEntity convert2Entity(VirtualDriverParam param);
    VirtualDriverVO convert2VO(VirtualDriverEntity entity);
    List<VirtualDriverVO> convert2VO(List<VirtualDriverEntity> lst);

    SpPremiumPriceEntity convert2Entity(SpPremiumPriceParam param);
    SpPremiumPriceVO convert2VO(SpPremiumPriceEntity entity);
    List<SpPremiumPriceVO> convert2SpPremiumLstVO(List<SpPremiumPriceEntity> lst);

    void convert(@MappingTarget ExpressCommonPriceEntity expressCommonPriceEntity, ExSaveParam param);
    void convert(@MappingTarget ExpressStpPriceEntity expressStpPriceEntity, StpSaveParam param);
    void convert(@MappingTarget IntercityPriceEntity intercityPriceEntity, IcSaveParam param);
    void convert(@MappingTarget SpecialCarPriceEntity specialCarPriceEntity, SpSaveParam param);

    FenceInfoEntity convert(FenceAddParam param);
    FenceInfoVO convert(FenceInfoEntity entity);

}
